package cn.xyinping.hrm.feign;

import cn.xyinping.hrm.doc.CourseDoc;
import cn.xyinping.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author 27266
 * @desrciption
 * @date 2021/11/28
 */
@Component
@Slf4j
public class CourseESFeignFallbackFactory implements FallbackFactory<CourseESFeign> {
    @Override
    public CourseESFeign create(Throwable throwable) {
        return new CourseESFeign(){

            @Override
            public AjaxResult save(CourseDoc doc) {
                log.error("服务降级了",throwable.getMessage());
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("系统繁忙");
            }
        };
    }
}
